﻿using SuperMicroWave.LogFile;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace SuperMicroWave
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            #region 用进程防止多开                           
            Process[] processcollection = Process.GetProcessesByName("SuperMicroWave");
            if (processcollection.Length > 1)
            {
                MessageBox.Show("应用程序已经在运行中");
                Environment.Exit(1);
                return;
            }
            #endregion

            InitializeComponent();
        }

        private async void CloseBtn_Click(object sender, RoutedEventArgs e)
        {
            if (MessageBox.Show("确定退出系统？", "提示", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
            {
                await Task.Delay(100);
                this.Close();
            }
        }
    }
}
